This invention relates to a logic operation system for detecting the first bit position having a 1 (or 0) as viewed from the least significant bit (LSB) of an input data by using a priority encoder capable of encoding the first bit position having a 1 (or 0) as viewed from the most significant bit (MSB).
FIG. 3 shows a conventional logic circuit for performing such an encoding operation. See the 1985 Mitsubishi Data Book, Bipolar Digital IC &lt;LSTTL&gt;, pp 2-162 to 2-163. In this figure, D is an 8-bit input data and D.sub.0 -D.sub.7 are respective bits. When the 8-bit data D is applied to the input terminals, a pair of priority encoders 11 and 12 detect the predetermined priority bit positions among those having a 1 and generate 3-bit binary encoded outputs A.sub.M and A.sub.L, respectively. The priority encoder 11 encodes the first bit position having a 1 as viewed from the MSB of the input data D while the priority encoder 12 encodes the first bit position having a 1 as viewed from the LSB.
FIG. 4 shows respective input and output bits of the priority encoder 11 or 12 of FIG. 3, in which like reference characters denote identical or equivalent parts or components of FIG. 3 and A.sub.0 -A.sub.2 are respective bits of the encoded output A.sub.M or A.sub.L.
FIGS. 5(a) and 5(b) show truth tables for the priority encoders 11 and 12, respectively, when the input and encoded output are 8-bit and 3-bit binary numbers, respectively. The symbol X is a given value.
The operation of this logic circuit will be described. Suppose that the input 8-bit data D is a binary number 00101010 and that the MSB and LSB are the 7th (D.sub.7) and 0th (D.sub.0) bits, respectively. This input data D has 1s at the 5th (D.sub.5), 3rd (D.sub.3), and 1st (D.sub.1) bit positions.
The priority encoder 11 encodes the bit position of the 1 that is closest to the MSB in the input data D. In this example, it is the 5th bit (D.sub.5). Consequently, the priority encoder 11 generates a binary number 101 encoding 5 of the 5th bit position D.sub.5 according to the truth table of FIG. 5(a). The priority encoder 12, on the other hand, encodes the bit position of the 1 that is closest to the LSB in the input data D. In this example, it is the 1st bit (D.sub.1). Consequently, the priority encoder 12 generates a binary number 001 encoding 1 of the 1st bit position D.sub.1 according to the truth table of FIG. 5(b).